home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / mappers.h < prev    next >
C/C++ Source or Header  |  1997-06-25  |  3KB  |  113 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. /* Modified by Klaus Gebhardt, 1997 */
  24.  
  25. #if !defined (octave_mappers_h)
  26. #define octave_mappers_h 1
  27.  
  28. #include <string>
  29.  
  30. #include "lo-mappers.h"
  31.  
  32. typedef int (*ch_Mapper)(int);
  33. typedef double (*d_d_Mapper)(double);
  34. typedef double (*d_c_Mapper)(const Complex&);
  35. typedef Complex (*c_c_Mapper)(const Complex&);
  36.  
  37. // ch_mapper is a kluge.
  38. //
  39. // If can_return_complex_for_real_arg is 1, lower_limit and
  40. // upper_limit specify the range of values for which a real arg
  41. // returns a real value.  Outside that range, we have to convert args
  42. // to complex, and call the complex valued function.
  43. //
  44. // If can_return_complex_for_real_arg is 0, lower_limit and
  45. // upper_limit are ignored.
  46.  
  47. struct builtin_mapper_function
  48. {
  49.   builtin_mapper_function (ch_Mapper ch = 0, d_d_Mapper dd = 0,
  50.                d_c_Mapper dc = 0, c_c_Mapper cc = 0,
  51.                double l = 0.0, double u = 0.0, int f = 0,
  52.                const string n = string (),
  53.                const string& h = string ())
  54.     : ch_mapper (ch), d_d_mapper (dd), d_c_mapper (dc), c_c_mapper (cc),
  55.       lower_limit (l), upper_limit (u), flag (f),
  56.       name (n), help_string (h) { }
  57.  
  58.   builtin_mapper_function (const builtin_mapper_function& mf)
  59.     : ch_mapper (mf.ch_mapper), d_d_mapper (mf.d_d_mapper),
  60.       d_c_mapper (mf.d_c_mapper), c_c_mapper (mf.c_c_mapper),
  61.       lower_limit (mf.lower_limit), upper_limit (mf.upper_limit),
  62.       flag (mf.flag), name (mf.name), help_string (mf.help_string) { }
  63.  
  64.   builtin_mapper_function& operator = (const builtin_mapper_function& mf)
  65.     {
  66.       if (&mf != this)
  67.     {
  68.       ch_mapper = mf.ch_mapper;
  69.       d_d_mapper = mf.d_d_mapper;
  70.       d_c_mapper = mf.d_c_mapper;
  71.       c_c_mapper = mf.c_c_mapper;
  72.       lower_limit = mf.lower_limit;
  73.       upper_limit = mf.upper_limit;
  74.       flag = mf.flag;
  75.       name = mf.name;
  76.       help_string = mf.help_string;
  77.     }
  78.       return *this;
  79.     }
  80.  
  81.   ~builtin_mapper_function (void) { }
  82.  
  83.   ch_Mapper ch_mapper;
  84.   d_d_Mapper d_d_mapper;
  85.   d_c_Mapper d_c_mapper;
  86.   c_c_Mapper c_c_mapper;
  87.   double lower_limit;
  88.   double upper_limit;
  89.  
  90.   // For ch_mapper:
  91.   //
  92.   //   0  =>  this function returns a matrix of ones and zeros
  93.   //   1  =>  this function returns a numeric matrix (any values)
  94.   //   2  =>  this function returns a string array
  95.   //
  96.   // For other mappers, nonzero means that this function can return a
  97.   // complex value for some real arguments.
  98.   int flag;
  99.  
  100.   string name;
  101.   string help_string;
  102. };
  103.  
  104. extern void install_mapper_functions (void);
  105.  
  106. #endif
  107.  
  108. /*
  109. ;;; Local Variables: ***
  110. ;;; mode: C++ ***
  111. ;;; End: ***
  112. */
  113.